const mysql = require("mysql");

var con = mysql.createConnection({
    host: '192.168.16.144',
    port: 3306,
    user: 'root',
    password: 'ddd',
    database: 'mydatabase'
})

var userName = process.argv[2];
var selectSql = "select userName,age from users where userName=?";

con.query(selectSql, [userName], (err,result)=>{
    if(err){
        console.log(err)
    }
    else{
        var userList = result;
        console.log(userList)
        for(var i=0; i<userList.length; i++){
            console.log(userList[i]["age"])
        }
    }
})